// buffer不是nodejs里的模块,是一个类，处理二进制的类
// node6.0之前 => new Buffer();
// let bf = new Buffer('111');

// 现在
// let buffer = Buffer.alloc(10);
// console.log(buffer);

// 字符串
// let buffer1 = Buffer.from('大家');
// console.log(buffer1);

// 数组
// let bf = Buffer.from(['0x31', '0x30']);
// console.log(bf.toString());

// concat连接
let bf1 = Buffer.from(['0xe5', '0xa4', '0xa7', '0xe5']);
let bf2 = Buffer.from(['0xae', '0xb6']);
// let newBf = Buffer.concat([bf1, bf2]);
// console.log(newBf.toString());

let { StringDecoder } = require('string_decoder');
let decoder = new StringDecoder();
let b1 = decoder.write(bf1);
let b2 = decoder.write(bf2);
console.log(b1 + b2);